﻿namespace CTP.CRM.Core.Rabbit
{
    public class RabbitOptions
    {
        public string ConnectionString { get; set; }

        [Obsolete("不再提供支持")]
        public int PoolSize { get; set; }

        public List<ConsumeOptions> Consumes { get; set; } = new();

        public List<Action<IDeclaration>> Declarations { get; set; } = new();
    }

    public class ConsumeOptions
    {
        /// <summary>
        /// 队列名
        /// </summary>
        public string Queue { get; set; }

        /// <summary>
        /// 并行度
        /// </summary>
        public ushort FetchCount { get; set; } = 1;

        /// <summary>
        /// handle发生异常，是否重回队列
        /// </summary>
        public bool FailedRequeue { get; set; }

        public Action<IDeclaration> Declaration { get; set; }
    }
}
